package com.iot.ic.common;


/**
 * @author 
 * @Description:返回值及返回描述
 * @date 2016年7月11日上午9:27:33
 */
public enum Options {
	
	
	HeadReferee(0, "裁判长", "refereeRole"),
	CommonReferee(1, "普通裁判", "refereeRole"),
	CommonUser(2, "普通用户", "refereeRole"),

    Passed(1, "通过", "passFlag"),
    NotPassed(0, "未未通过", "passFlag"),
    
    Start(0, "已开始", "matchState"),
    Finished(1, "已结束", "matchState"),
    
    CityStadium(1, "城市赛场", "stadiumType"),
    HighSpeedStadium(2, "高速赛场", "stadiumType"),
    Suburbs(3, "城郊赛场", "stadiumType"),
    
    
    Scenes(0, "场景", "scenesType"),
    Road(1, "路段", "scenesType"),
    
    ManualIntervention(0, "人工干预", "interveneType"),
    ManualDriving(1, "人工代驾", "interveneType"),
    
    Close(0, "关闭", "close"),
    Open(1, "开启", "open"),
    
    Normal(0, "正常", "teamState"),
    Fault(1, "故障", "teamState"),
    Pause(2, "暂停", "teamState"),
    Finish(3, "已结束", "teamState"),
    NoStart(4, "未开始", "teamState"),

    Deleted(1, "已删除", "delFlag"),
    NotDel(0, "未删除", "delFlag"),;
	
	
	

	
	


    private int code;

    private String description;

    private String tag;

    Options(int code, String description, String tag) {
        this.code = code;
        this.description = description;
        this.tag = tag;
    }

    public int getCode() {
        return this.code;
    }

    public String getDescription() {
        return this.description;
    }

    public String getTag() {
        return this.tag;
    }


    public static Options stateOf(int index) {

        for (Options state : values()) {
            if (state.getCode() == index) {
                return state;
            }
        }
        return null;
    }

    public static String getDescByTag(Integer code, String tag) {
        if (code == null) {
            return "";
        }
        for (Options state : values()) {
            if (state.getCode() == code && state.getTag().equals(tag)) {
                return state.getDescription();
            }
        }
        return "";
    }


}
